-
Notifications
You must be signed in to change notification settings - Fork 3
feat: s3 health check #723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: s3 health check #723
Conversation
Test Results 234 files +2 234 suites +2 8m 32s ⏱️ +24s Results for commit 19b174e. ± Comparison against base commit 662ff2a. This pull request removes 4 and adds 3 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
c311c46
to
0ce08d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some comments.
if (LOGGER.isErrorEnabled()) { | ||
LOGGER.error(e.getMessage(), e); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: Imho this can be simplified, as LOGGER.error
will also suppress the message if not enabled (and error is likely always enabled). I would also go for a custom message and attach the exception, e.g. like this:
if (LOGGER.isErrorEnabled()) { | |
LOGGER.error(e.getMessage(), e); | |
} | |
LOGGER.error("S3 health check failed to get info of bucket {}", bucketName, e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the health check is propagating to the health endpoint anyways, I wonder if the log could also be a warning.
@SetSystemProperty(key = "management.health.s3.enabled", value = "true") | ||
@SpringBootTest( | ||
classes = S3TestApp.class, | ||
webEnvironment = WebEnvironment.RANDOM_PORT, | ||
properties = {"auth.disable=true", "opa.disable=true", "management.server.port=8071"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: As this is a SpringBootTest, isn't it possible to set it as property?
@SetSystemProperty(key = "management.health.s3.enabled", value = "true") | |
@SpringBootTest( | |
classes = S3TestApp.class, | |
webEnvironment = WebEnvironment.RANDOM_PORT, | |
properties = {"auth.disable=true", "opa.disable=true", "management.server.port=8071"}) | |
@SpringBootTest( | |
classes = S3TestApp.class, | |
webEnvironment = WebEnvironment.RANDOM_PORT, | |
properties = {"auth.disable=true", "opa.disable=true", "management.server.port=8071", "management.health.s3.enabled=true"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately no, because otherrwise it would ovewrite the @SetSystemProperty
in the checkThatS3HealthCheckIsNotEnabled
test.
webEnvironment = WebEnvironment.RANDOM_PORT, | ||
properties = {"auth.disable=true", "opa.disable=true", "management.server.port=8071"}) | ||
@S3Test | ||
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: Can the dirty context be avoided if we don't use SetSystemProperty? Afaik, this slows down the test suite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that I want to test when it is enabled and when it is not, so I need to run the server again for each test. In order to do that I either use this approach or I separate in two test classes, one with the health check enabled, and the other one disabled.
0ce08d9
to
19b174e
Compare
No description provided.